Skip to content

fix: cross-platform path assertions in resolveModelFile tests#1

Merged
lmangani merged 2 commits intomainfrom
copilot/update-tests-resolve-model-file
Mar 21, 2026
Merged

fix: cross-platform path assertions in resolveModelFile tests#1
lmangani merged 2 commits intomainfrom
copilot/update-tests-resolve-model-file

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

On Windows, path.resolve("/data/models") prepends the current drive letter (e.g. D:\data\models\dit.gguf), causing hardcoded POSIX path assertions to fail in CI.

Changes

  • test/paths.test.ts: Both resolveModelFile tests that asserted /data/models/dit.gguf now branch on process.platform:
    • Windows: actual.toLowerCase().toContain("\\data\\models\\dit.gguf")
    • POSIX: original strict equality / normalized comparison preserved
const actual = resolveModelFile("dit.gguf");
if (process.platform === "win32") {
  expect(actual.toLowerCase()).toContain("\\data\\models\\dit.gguf");
} else {
  expect(actual).toBe("/data/models/dit.gguf");
}
Original prompt

The tests for resolveModelFile() expect '/data/models/dit.gguf', but on Windows, path.resolve and path.join turn '/data/models' into 'D:\data\models\dit.gguf'.

To make tests pass on all platforms, update the assertions in 'test/paths.test.ts'. Use platform-specific expectations: on Windows, check that the result ends with '\data\models\dit.gguf' (or .toLowerCase().includes("\data\models\dit.gguf")), and otherwise check '/data/models/dit.gguf'.

Update both tests in 'describe("resolveModelFile", ...)' that use '/data/models'.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The job is failing due to an assertion error in the test for resolveModelFile when ACESTEP_MODELS_DIR is set to a Unix-style path (/data/models) on Windows. The expected output is "\data\models\dit.gguf" or "/data/models/dit.gguf", but the function returns "D:\data\models\dit.gguf" due to path resolution behavior on Windows.

Solution:
To align expectations and function output, update the test assertions to allow absolute Windows paths (like "D:\data\models\dit.gguf") when running on Windows, or adjust the resolveModelFile function to handle Unix-style root paths more predictably across platforms.

Recommended code fix for the test (test/paths.test.ts):

Replace the hardcoded expectation with a check that matches the actual absolute path:

test("joins models dir for bare filename", () => {
process.env.ACESTEP_MODELS_DIR = "/data/models";
const actual = resolveModelFile("dit.gguf");
if (process.platform === "win32") {
expect(actual.toLowerCase()).toContain("\data\models\dit.gguf");
} else {
expect(actual).toBe("/data/models/dit.gguf");
}
});

This makes the test pass both on Windows and POSIX systems. Or, if "D:\data\models" is not intended, you may want to fix how paths are being resolved when using Unix-style paths on Windows in src/paths.ts.

User: fix this in a quick PR

Assistant: A pull request will be opened to fix the cross-platform path test—updating the test assertions in test/paths.test.ts to work correctly on both Windows and POSIX systems, ensuring resolveModelFile passes regardless of platform.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update tests for resolveModelFile path assertions fix: cross-platform path assertions in resolveModelFile tests Mar 21, 2026
Copilot AI requested a review from lmangani March 21, 2026 01:12
@lmangani lmangani marked this pull request as ready for review March 21, 2026 01:22
@lmangani lmangani merged commit 96a209a into main Mar 21, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants